﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Haidou.Wpf.UI.ViewModel
{
	public class FloatingHubViewModel : ObservableObject
	{
		public ObservableCollection<MenuItemVM> MenuItems { get; } = new();
		public bool IsExpanded
		{
			get => _isExpanded;
			set { SetProperty(ref _isExpanded, value); OnPropertyChanged(nameof(ScaleTarget)); }
		}
		private bool _isExpanded;
		public double ScaleTarget => IsExpanded ? 1.0 : 0.0;

		public ICommand ToggleExpandCommand { get; }
		public FloatingHubViewModel()
		{
			//ToggleExpandCommand = new RelayCommand(_ => IsExpanded = !IsExpanded);
			BuildMenu();
		}
		void BuildMenu()
		{
			// Icon 使用 Segoe Fluent Icons 代码点，可替换
			Add("待办", "\uE8FD", OpenTodo);
			Add("备忘", "\uE70B", OpenMemo);
			Add("密码盒", "\uE72E", OpenVault);
			Add("测速", "\uE774", OpenSpeed);
		}
		void Add(string title, string icon, Action action)
		{
			MenuItems.Add(new MenuItemVM
			{
				Title = title,
				Icon = icon,
				//Command = new RelayCommand(_ => action()),
				AnimDelay = TimeSpan.FromMilliseconds(30 * MenuItems.Count)
			});
		}
		void OpenTodo() { /* TODO: show pane */ }
		void OpenMemo() { /* TODO */ }
		void OpenVault() { /* TODO */ }
		void OpenSpeed() { /* TODO */ }
	}

	public class MenuItemVM : ObservableObject
	{
		public string Title { get; set; }
		public string Icon { get; set; }
		public ICommand Command { get; set; }
		public TimeSpan AnimDelay { get; set; }
	}
}
